package com.wenson.structural.proxy;

import java.util.Arrays;
import java.util.List;

/**
 * @ClassName: RouterProxy
 * @Author: luowangcheng
 * @Date: 2024/6/14 22:06
 * @Description:
 */
public class RouterProxy implements Internet {
    private Internet modem; //被代理对象
    private List<String> blackList = Arrays.asList("电影", "游戏", "音乐", "小说");

    public RouterProxy() throws Exception {
        this.modem = new Modem("123456"); //实例化被代理类
    }

    @Override
    public void httpAccess(String url) {
//        for (String keyword : blackList) { //遍历黑名单
//            if (url.contains(keyword)) {
//                System.out.println("禁止访问：" + url);
//                return;
//            }
//
//        }
        modem.httpAccess(url);//转发请求至modem以访问互联网
    }
}
